Precision machine vision inspection systems (or “vision systems” in short) can be utilized to obtain precise dimensional measurements of inspected objects and to inspect various other object characteristics. Such systems may include a computer, a camera and optical system, and a precision stage that is movable in multiple directions so as to allow the camera to scan the features of a workpiece that is being inspected. One exemplary prior art system that is commercially available is the QUICK VISION® series of PC-based vision systems and QVPAK® software available from Mitutoyo America Corporation (MAC), located in Aurora, Ill. The features and operation of the QUICK VISION® series of vision systems and the QVPAK® software are generally described, for example, in the QVPAK 3D CNC Vision Measuring Machine User's Guide, published January 2003, and the QVPAK 3D CNC Vision Measuring Machine Operation Guide, published September 1996, each of which is hereby incorporated by reference in their entirety. This product, as exemplified by the QV-302 Pro model, for example, is able to use a microscope-type optical system to provide images of a workpiece at various magnifications, and move the stage as necessary to traverse the workpiece surface beyond the limits of any single video image. A single video image typically encompasses only a portion of the workpiece being observed or inspected, given the desired magnification, measurement resolution, and physical size limitations of such systems.
Machine vision inspection systems generally utilize automated video inspection. U.S. Pat. No. 6,542,180 teaches various aspects of such automated video inspection and is incorporated herein by reference in its entirety. As taught in the '180 patent, automated video inspection metrology instruments generally have a programming capability that allows an automatic inspection event sequence to be defined by the user for each particular workpiece configuration. This can be implemented by text-based programming, for example, or through a recording mode which progressively “learns” the inspection event sequence by storing a sequence of machine control instructions corresponding to a sequence of inspection operations performed by a user, or through a combination of both methods. Such a recording mode is often referred to as “learn mode” or “training mode.” Once the inspection event sequence is defined in “learn mode,” such a sequence can then be used to automatically acquire (and additionally analyze or inspect) images of a workpiece during “run mode.”
The machine control instructions including the specific inspection event sequence (i.e., how to acquire each image and how to analyze/inspect each acquired image) are generally stored as a “part program” or “workpiece program” that is specific to the particular workpiece configuration. For example, a part program defines how to acquire each image, such as how to position the camera relative to the workpiece, at what lighting level, at what magnification level, etc. Further, the part program defines how to analyze/inspect an acquired image, for example, by using one or more video tools such as edge/boundary detection video tools. One critical aspect is whether the acquired images are in focus.
Proper operation of a video tool depends on correct settings of various machine, image, and video tool parameters that affect the operation of the tool. For example, for an edge/boundary detection video tool to locate a target edge/boundary in an image, the image should be acquired with a correct level of focus, lighting/brightness, magnification, etc. In addition, the region of interest of a video tool (i.e., the region within a video image that the video tool searches) must be set so as to actually contain an edge/boundary workpiece feature to be detected.
Generally, the relevant machine and video tool parameters that govern acquiring an image of a workpiece feature and inspecting the feature are established and set under rather ideal conditions at the outset of defining and training a video tool, for example during a training mode of operation and programming. This is because, generally, an operator observes a real-time display of the workpiece feature and adjusts the relevant machine and video tool parameters, such as focusing, machine positioning, lighting, tool positioning and orientation, and other parameters until they are observed to be in a relatively ideal state for providing an accurate inspection result for the workpiece feature. However, during subsequent repeated automatic operation of the video tool in run mode, various unforeseen variations in part fabrication, part fixturing, vision machine degeneration, ambient lighting conditions, and the like, may contribute to a set of operating conditions that are not suitable for the proper operation of the video tool according to its previously established operating parameters. Thus, conventional video tools may fail to operate properly during “run mode” operations, for example, due to one or more unexpected variations in operating conditions or workpiece characteristics. Conventional video tools may also fail to operate properly during “learn mode” operations, because a relatively inexperienced user may be unable to set the relevant machine, image, or video tool parameters correctly, due to poor understanding of the operation of the tool and/or inexperience regarding its application.
One of the issues that may cause a video tool to fail to operate properly is when an image that is being inspected is out of focus. To improve upon an image that may be out of focus, the system may run an autofocus process. One drawback of the autofocus process is that it involves a relatively time consuming mechanical process consisting of acquiring a series of images at different camera-object distances, computing image characteristics indicative of the focus state (e.g. image contrast) for each acquired image, and finding the best focus position throughout the focus range of all the acquired images.
Therefore, a need exists for a system and method for assessing image focus from a single image. One use for such a system and method is that in various applications it allows processing time to be saved by avoiding running an autofocus process, if an image is already in focus.